# Detect UFS compiler suite and set at parent scope

if(CMAKE_C_COMPILER_ID STREQUAL "Intel" AND 
    CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND 
    CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
  set(UFS_COMPILER_SUITE "Intel")
elseif(CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM" AND
    CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" AND
    CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
  set(UFS_COMPILER_SUITE "IntelMixed")
elseif(CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM" AND
    CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" AND
    CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM")
  set(UFS_COMPILER_SUITE "IntelLLVM")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
    CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
    CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
  set(UFS_COMPILER_SUITE "GNU")
else()
  message(FATAL_ERROR "Unsupported combination of compilers (CC/CXX/FC): "
    "${CMAKE_C_COMPILER_ID}/${CMAKE_CXX_COMPILER_ID}/${CMAKE_Fortran_COMPILER_ID}")
endif()

message(STATUS "UFS Compiler Suite: ${UFS_COMPILER_SUITE}")
